<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="dromara.org" />
	<meta name="description" content="dromara.org" />
	<!-- 网页标签标题 -->
	<title>dromara(Open source organization)</title>
	<link rel="shortcut icon" href="/website/img/docsite.ico"/>
	<link rel="stylesheet" href="/website/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/website/zh-cn/index.html"><img class="logo" src="/website/img/dromara.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><div class="header-menu"><img class="header-menu-toggle" src="/website/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/website/zh-cn/index.html" target="_self">首页</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/website/zh-cn/docs/soul/soul.html" target="_self">文档</a></li><li class="menu-item menu-item-normal"><a href="/website/zh-cn/blog/index.html" target="_self">博客</a></li><li class="menu-item menu-item-normal"><a href="/website/zh-cn/community/index.html" target="_self">社区</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/website/img/system/docs.png" class="front-img"/><span>文档</span><img src="/website/img/system/docs.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Soul</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/soul.html" target="_self">soul介绍</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/db.html" target="_self">数据库设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/config.html" target="_self">配置中心设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/request.html" target="_self">请求参数设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/selector.html" target="_self">选择器规则设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/preFilter.html" target="_self">前置过滤器设计</a></li><li style="height:324px;overflow:hidden" class="menu-item menu-item-level-2"><span>插件介绍<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/divide.html" target="_self">divide插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/dubbo.html" target="_self">dubbo插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/springcloud.html" target="_self">springcloud插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/rateLimiter.html" target="_self">rateLimiter插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/monitor.html" target="_self">monitor插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/waf.html" target="_self">waf插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/sign.html" target="_self">sign插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/rewrite.html" target="_self">rewrite插件</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>部署文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/admin.html" target="_self">部署admin</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/server.html" target="_self">部署server</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/http.html" target="_self">使用手册</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/extend.html" target="_self">扩展文档</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Hmily</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/index.html" target="_self">介绍文档</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/configuration.html" target="_self">配置详解</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/admin.html" target="_self">启动admin</a></li><li style="height:144px;overflow:hidden" class="menu-item menu-item-level-2"><span>用户文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-dubbo.html" target="_self">dubbo用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-motan.html" target="_self">motan用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-springcloud.html" target="_self">springcloud用户</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>快速体验<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/quick-start-dubbo.html" target="_self">quick-start-dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/quick-start-springcloud.html" target="_self">quick-start-springcloud</a></li></ul></li></ul></li><li class="menu-item menu-item-level-1"><span>raincat</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/index.html" target="_self">介绍文档</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/start-manager.html" target="_self">启动raincat-manager</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/config.html" target="_self">配置详解</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/admin.html" target="_self">启动admin</a></li><li style="height:144px;overflow:hidden" class="menu-item menu-item-level-2"><span>用户文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-dubbo.html" target="_self">dubbo用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-motan.html" target="_self">motan用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-springcloud.html" target="_self">springcloud用户</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>快速体验<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/quick-start-dubbo.html" target="_self">quick-start-dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/quick-start-springcloud.html" target="_self">quick-start-springcloud</a></li></ul></li></ul></li><li class="menu-item menu-item-level-1"><span>myth</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/myth/index.html" target="_self">介绍文档</a></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>jar包依赖</h1>
<ul>
<li>在你的接口项目中引入jar包。</li>
</ul>
<pre><code class="language-java">      &lt;dependency&gt;
          &lt;groupId&gt;org.dromara.hmily&lt;/groupId&gt;
          &lt;artifactId&gt;hmily-annotation&lt;/artifactId&gt;
          &lt;version&gt;2.0.0-RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
</code></pre>
<ul>
<li>
<p>在你的dubbo rpc接口上加入 @Hmily注解</p>
</li>
<li>
<p>在你的实现项目中引入jar包，并在实现接口上添加:@Hmily(confirmMethod = &quot;confrim&quot;, cancelMethod = &quot;cancel&quot;)confirmMethod，cancelMethod对应为的方法名称</p>
</li>
</ul>
<pre><code class="language-xml">        <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara.hmily<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>hmily-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.0.0-RELEASE<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ul>
<li>
<p>注意 confrim 与cancel 方法的参数列表与你的接口保持一致。</p>
</li>
<li>
<p>confrim 方法为你try 方法的确认方法,由用户自己开发。</p>
</li>
<li>
<p>cancel方法是try 方法的回滚方法,由用户自己开发。</p>
</li>
</ul>
<h1>Spring XML 配置 HmilyTransactionBootstrap</h1>
<pre><code class="language-xml">  <span class="hljs-comment">&lt;!-- Aspect 切面配置，是否开启AOP切面--&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">aop:aspectj-autoproxy</span> <span class="hljs-attr">expose-proxy</span>=<span class="hljs-string">"true"</span>/&gt;</span>
  <span class="hljs-comment">&lt;!--扫描框架的包--&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">context:component-scan</span> <span class="hljs-attr">base-package</span>=<span class="hljs-string">"org.dromara.hmily.*"</span>/&gt;</span>
  <span class="hljs-comment">&lt;!--启动类属性配置--&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"hmilyTransactionBootstrap"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"org.dromara.hmily.core.bootstrap.HmilyTransactionBootstrap"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"serializer"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"kryo"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"recoverDelayTime"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"120"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"retryMax"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"3"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"loadFactor"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"2"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"scheduledDelay"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"120"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"scheduledThreadMax"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"4"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"bufferSize"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"4096"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"consumerThreads"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"32"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"started"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"false"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"asyncThreads"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"32"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"repositorySupport"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"db"</span>/&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"hmilyDbConfig"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"org.dromara.hmily.common.config.HmilyDbConfig"</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"url"</span>
                          <span class="hljs-attr">value</span>=<span class="hljs-string">"jdbc:mysql://192.168.1.98:3306/tcc?useUnicode=true&amp;amp;characterEncoding=utf8"</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"driverClassName"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"com.mysql.jdbc.Driver"</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"username"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"root"</span>/&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"password"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"123456"</span>/&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
</code></pre>
<ul>
<li>
<p>配置开启AOP切面。</p>
</li>
<li>
<p>扫描Hmily框架的包。</p>
</li>
<li>
<p>配置Hmiiy框架参数。</p>
</li>
</ul>
<h1>Spring boot start 配置 HmilyTransactionBootstrap</h1>
<ul>
<li>在你的实现项目中引入Springboot-start支持的包，并在实现接口上添加:</li>
</ul>
<pre><code class="language-xml">        <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>hmily-spring-boot-starter-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.0.0-RELEASE<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ul>
<li>在你的yml中配置</li>
</ul>
<pre><code class="language-yml"><span class="hljs-attr">org:</span>
<span class="hljs-attr">    dromara:</span>
         <span class="hljs-string">hmily</span> <span class="hljs-string">:</span>
            <span class="hljs-string">serializer</span> <span class="hljs-string">:</span> <span class="hljs-string">kryo</span>
            <span class="hljs-string">recoverDelayTime</span> <span class="hljs-string">:</span> <span class="hljs-number">128</span>
            <span class="hljs-string">retryMax</span> <span class="hljs-string">:</span> <span class="hljs-number">30</span>
            <span class="hljs-string">scheduledDelay</span> <span class="hljs-string">:</span> <span class="hljs-number">128</span>
            <span class="hljs-string">scheduledThreadMax</span> <span class="hljs-string">:</span>  <span class="hljs-number">10</span>
            <span class="hljs-string">repositorySupport</span> <span class="hljs-string">:</span> <span class="hljs-string">db</span>
<span class="hljs-attr">            started:</span> <span class="hljs-literal">false</span>
            <span class="hljs-string">hmilyDbConfig</span> <span class="hljs-string">:</span>
                 <span class="hljs-string">driverClassName</span>  <span class="hljs-string">:</span> <span class="hljs-string">com.mysql.jdbc.Driver</span>
                 <span class="hljs-string">url</span> <span class="hljs-string">:</span>  <span class="hljs-attr">jdbc:mysql://192.168.1.98:3306/tcc?useUnicode=true&amp;amp;characterEncoding=utf8</span>
                 <span class="hljs-string">username</span> <span class="hljs-string">:</span> <span class="hljs-string">root</span>
                 <span class="hljs-string">password</span> <span class="hljs-string">:</span> <span class="hljs-number">123456</span>

</code></pre>
<ul>
<li>
<p>具体的详解请看<a href="configuration.md">配置详解</a></p>
</li>
<li>
<p>可以参考<a href="https://github.com/yu199195/hmily/tree/master/hmily-demo">demo</a></p>
</li>
</ul>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/website/img/dromara.png"/><div class="cols-container"><div class="col col-12"><h3>免责声明</h3><p>任何单位或个人转载本网站的所有相关信息，请注明来源。</p></div><div class="col col-6"><dl><dt>文档</dt><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">概览</a></dd><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">快速开始</a></dd><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">开发者指南</a></dd></dl></div><div class="col col-6"><dl><dt>资源</dt><dd><a href="/website/zh-cn/blog/index.html" target="_self">博客</a></dd><dd><a href="/website/zh-cn/community/index.html" target="_self">社区</a></dd></dl></div></div><div class="copyright"><span>Copyright ©2018 549477611@qq.com by xiaoyu</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '/website';
  </script>
	<script src="/website/build/documentation.js"></script>
</body>
</html>